//
//  HWTools.h
//  OCDome
//
//  Created by 李含文 on 2020/7/30.
//  Copyright © 2020 李含文. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

#if DEBUG
#define NSLog(FORMAT, ...) fprintf(stderr,"\n方法:%s 行数:%d\n%s\n", __FUNCTION__, __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#else
#define NSLog(FORMAT, ...) nil
#endif

#define HWWeakSelf __weak typeof(self) weakSelf = self;

#define HWStrongSelf __strong __typeof(weakSelf) strongSelf = weakSelf;
/// 获取状态栏的高度 
#define hw_statusBarHight [HWTools statusBarHight]
/// 是否是x系列
#define hw_isIphoneX [HWTools isIphoneX]
/// 安全高度
#define hw_safeHeight [HWTools safeHeight]
/// 屏幕高度
#define hw_screenHeight [HWTools screenHeight]
/// 屏幕宽度
#define hw_screenWidth [HWTools screenWidth]
/// tabBar高度
#define hw_tabBarHeight [HWTools tabBarHeight]
/// nav高度
#define hw_navHeight [HWTools navHeight]

///  获取window
UIKIT_EXTERN UIWindow * _Nullable HW_MainWindow(void);
/// 获取当前栈顶控制器
UIKIT_EXTERN UIViewController * _Nullable hw_getVisibleViewController(void);

/* 回主线程操作 */
static inline void hw_dispatch_main_queue(void(^block)(void)) {
    if (!block) { return; }
    if (dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) == dispatch_queue_get_label(dispatch_get_main_queue())) {
        block();
    } else {
        dispatch_async(dispatch_get_main_queue(), block);
    }
}

@interface HWTools : NSObject
/// 获取状态栏的高度
+ (CGFloat)statusBarHight;
/// 是否是x系列
+ (BOOL)isIphoneX;
/// 安全宽度
+ (CGFloat)safeHeight;
/// 屏幕高度
+ (CGFloat)screenHeight;
/// 屏幕宽度
+ (CGFloat)screenWidth;
/// tabBar高度
+ (CGFloat)tabBarHeight;
/// nav高度
+ (CGFloat)navHeight;
@end

NS_ASSUME_NONNULL_END



